{% extends "base.html" %}
{% load i18n %}

{% block main_panel %}
<div class="wide-panel">
    <p class="access-notice">{% trans "Please input the password if you want to browse the shared file/directory." %}</p>
    {% if path %}
    <form action="{% url view_name token %}?p={{ path }}" method="post" id="share-passwd-form">{% csrf_token %}
    {% else %}
    <form action="{% url view_name token %}" method="post" id="share-passwd-form">{% csrf_token %}
    {% endif %}
        <input type="text" name="token" value="{{ token }}" class="hide" />
        <label>{% trans "Password: " %}</label><br />
        <input type="password" name="password" class="input" autofocus /><br />
        {% if err_msg %}
        <p class="error">{{ err_msg }}</p>
        {% endif %}
        <input type="submit" value="{% trans "Submit" %}" />
    </form>
</div>
{% endblock %}
{% block extra_script %}
<script type="text/javascript">
$('#share-passwd-form').on('submit', function() {
    var form = $(this),
        pwd = $('[name="password"]', form).val(),
        err = $('.error',form);
    if (!$.trim(pwd)) {
        err.html("{% trans "Please enter the password." %}").removeClass('hide');
        return false;
    }
});
</script>
{% endblock %}
